package 适配器模式;//package step1;

import java.util.Scanner;

public class Client {
    public static void main(String[] args) {
        DataOperation dataOperation = new OperationAdapter(new QuickSort(),new BinarySearch());
        int i = 0;
        Scanner scanner = new Scanner(System.in);
        int count = scanner.nextInt();
        int[] array = new int[count];
        while (scanner.hasNext()) {
            array[i++] = scanner.nextInt();
            if (i == array.length) {
                break;
            }
        }
        int key = scanner.nextInt();
        dataOperation.sort(array);
        System.out.println("实现快速排序：");
        for(i = 0; i<array.length; i++){
            System.out.print(array[i]+" ");
        }
        System.out.println("\n"+"实现了二分查找算法：");
        System.out.println(dataOperation.search(array, key));
    }
}
